define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Livechat3, $stateParams, $sce, GoPage, GoDialog) {
		$scope.uid = $stateParams.uid;
		$scope.code = $stateParams.code;
		$scope.wckey = $stateParams.wckey;
		$scope.url = 'mobile';
		//页面离开，分享关闭
		$scope.$on('$ionicView.afterEnter', function() {
			$scope.loadIframe();
			//动态设置高度
			GoPage.init_top($scope, 0, 0);
		}, false);
		$scope.loadIframe = function() {
			var url = HTTP_CHAT3_URL + "?uid=" + $scope.uid +
				"&code=" + $scope.code +
				"&vvckey=" + $scope.wckey;
			$scope.myURL = $sce.trustAsResourceUrl(url);
		};
	}

	controller.$inject = ['$scope', 'Livechat3', '$stateParams', '$sce', 'GoPage', 'GoDialog'];

	return app.registerController("livechat3ctrl", controller);
});